#include<iostream>
#include<algorithm>
#include<string>
using namespace std;
int main()
{
	string s;
	getline(cin, s);
	reverse(s.begin(), s.end());
	auto start = s.begin();
	auto end = s.end();
	while (start < s.end())
	{
		end = start;
		while (end < s.end() && *end!=' ')
		{
			end++;
		}
		reverse(start, end);
		if (end!=s.end())
		{
			start = end + 1;
		}
		else
		{
			start = end;
		}
	}
	cout << s;
	return 0;
}